<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Modify Event #{eventBean.eventViewed.title}</title>
    </h:head>
    <h:body>
        <h:form>
            <p:panel header="Modify Event">
                <p:panelGrid id="eventGrid" columns="3">
               
                
                <h:outputText value="Title: "/>
                <h:inputText id="title" value="#{eventBean.eventViewed.title}" disabled="true">
                    <p:ajax update="titlemsg"></p:ajax>
                </h:inputText>
                <p:message id="titlemsg" for="title"/>
                
                <h:outputText value="Description: "/>
                <p:inputTextarea id="description" rows="5" cols="20" maxlength="255" value="#{eventBean.eventViewed.description}"/>
                <p:message id="descriptionmsg" for="description"/>
                
                <h:outputText value="Country: "/>
                <h:inputText id="country" value="#{eventBean.eventViewed.country}"/>
                <p:message id="countrymsg" for="country"/>
                
                <h:outputText value="City: "/>
                <h:inputText id="city" value="#{eventBean.eventViewed.city}"/>
                <p:message id="citymsg" for="city"/>
                
                <h:outputText value="Address: "/>
                <h:inputText id="address" value="#{eventBean.eventViewed.address}"/>
                <p:message id="addressmsg" for="address"/>
                
                <h:outputText value="Visibility: "/>
                <p:selectOneButton id="visibility" value="#{eventBean.eventViewed.visibiltiy}" required="true" 
                                   requiredMessage="You must pick one">
                    <f:selectItem itemLabel="Public" itemValue="PUBLIC"/>
                    <f:selectItem itemLabel="Private" itemValue="PRIVATE"/>
                </p:selectOneButton> 
                <p:message id="visibilitymsg" for="visibility"/>
                
                <h:outputText value="Location: "/>
                <p:selectOneButton  id="location" value="#{eventBean.eventViewed.location}" required="true"
                                    requiredMessage="You must pick one">
                    <f:selectItem itemLabel="Indoor" itemValue="INDOOR"/>
                    <f:selectItem itemLabel="Outdoor" itemValue="OUTDOOR"/>
                </p:selectOneButton> 
                <p:message id="locationmsg" for="location"/>
                
                <h:outputText value="Start Date: "/>
                <p:calendar id="startDate" binding="#{startDateComponent}" value="#{eventBean.eventViewed.startDate}" pattern="MM/dd/yyyy HH:mm:ss">
                    <p:ajax update="startDatemsg"/>
                </p:calendar>
                <p:message id="startDatemsg" for="startDate"/>
                
                
                
                <h:outputText value="End Date: "/>
                <p:calendar id="endDate" value="#{eventBean.eventViewed.endDate}" pattern="MM/dd/yyyy HH:mm:ss">
                    <p:ajax update="endDatemsg"/>
                    <f:validator validatorId="dataRangeValidator"/>
                    <f:attribute name="startDateComponent" value="#{startDateComponent}"/>
                </p:calendar>
                <p:message id="endDatemsg" for="endDate"/>
                
                
               
                           
            </p:panelGrid>
                
                <p:commandButton id="invitings" value="Invite" update="eventGrid" action="#{eventBean.invitings('modifyEvent')}" >
                
                </p:commandButton>
                
                <p:commandButton id="submit" value="Submit" update="eventGrid" action="#{eventBean.modify()}"/>
            </p:panel>
            
            
            <br/>
            <p:link outcome="home" value="Back Home"/>
            
            
        </h:form>
    </h:body>
</html>
